import { Entity, PrimaryGeneratedColumn, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { Article } from './article.entity'
import { User } from './user.entity';

@Entity()
export class ArticleCollect {
    @PrimaryGeneratedColumn('uuid')
    id: string

    @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP(6)', select: true })
    createdAt: Date;

    @CreateDateColumn({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP(6)', select: false })
    updatedAt: Date;

    @ManyToOne(() => Article, article => article.collects)
    @JoinColumn({ name: 'article_id' })
    article: Article

    @ManyToOne(() => User, user => user.articleCollectUser)
    user: User


}